UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yWgwzE3BlYX7wSY4YAQt6b3dqNCgm1so8PfOf1WLu3I='
WHERE
key_id = '27c2de4fff4cce6dd9c788f6317258f25ed9eb8d9b254832a043befd454bbf91'
AND (
token = 'yWgwzE3BlYX7wSY4YAQt6b3dqNCgm1so8PfOf1WLu3I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)