UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xADrlh7ocWB7VggBb3/LCDYIRVkoyKxanLrXxf6Acs8='
WHERE
key_id = 'de605c3412e7aac71f2634f2d8d89e8035ba4eef4440ab85f97607f45f2bf775'
AND (
token = 'xADrlh7ocWB7VggBb3/LCDYIRVkoyKxanLrXxf6Acs8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)