UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ugnjsow8s5HZ68bVHmjxxXe6u2UIC5X5HZMPaTKVOtw='
WHERE
key_id = '34eb4ff8df2e13cc7c9f5bed5eb09383937b3750a2f75573d4b8a6b764aaa671'
AND (
token = 'ugnjsow8s5HZ68bVHmjxxXe6u2UIC5X5HZMPaTKVOtw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)