UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BhJdou21+D0IKRLtYgnKzEeL8ukJRTcznd9KVIsnEaU='
WHERE
key_id = '3de03ff430c4977215bf3c46a737eee92dd0caaab50d4b8c0c11b1e3fb088219'
AND (
token = 'BhJdou21+D0IKRLtYgnKzEeL8ukJRTcznd9KVIsnEaU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)