UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '82cg7ny8TNYiWsSKUT4yUJOtoSoka81E+Jw4CzlYn2o='
WHERE
key_id = '50ef93d76c06b14d85e480c7ff32dda76c303a56d2f9c5db461484c3c09acc5b'
AND (
token = '82cg7ny8TNYiWsSKUT4yUJOtoSoka81E+Jw4CzlYn2o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)