UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uYXZ4yiAoLJXK5FcWC+68R6MbKpavM6XbD5YYovyD+Y='
WHERE
key_id = '7ba511d50742923d12cc8ab299cbb3cb9f2ebcd158c2c59d44d7cf23b38f644f'
AND (
token = 'uYXZ4yiAoLJXK5FcWC+68R6MbKpavM6XbD5YYovyD+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)