UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ynqRc1lyf2Co1AHlA3HTRrY9cvGSlwcUFeUR05nXKn8='
WHERE
key_id = '916c9dd9b545084565d472fe1e81b2d4c5c7f60efa864b3dd7e5a3b30e3afe28'
AND (
token = 'ynqRc1lyf2Co1AHlA3HTRrY9cvGSlwcUFeUR05nXKn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)