UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AE9VoXjOwH4Je17MPD7FGW9eXXIwmuc0WieIJJGdcLQ='
WHERE
key_id = 'a51f9b670298b2a9081e8c95eebed165552c35f322ddba323043fb66c6d8d3e4'
AND (
token = 'AE9VoXjOwH4Je17MPD7FGW9eXXIwmuc0WieIJJGdcLQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)