UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ItAgTVyHpfX1UvCKHBCCwoxThOm5JnvHqerglZJ6kqU='
WHERE
key_id = '8aef801849aebaf53dce89f98a5f2b2ced002e7cc2911db1417830998ae62aff'
AND (
token = 'ItAgTVyHpfX1UvCKHBCCwoxThOm5JnvHqerglZJ6kqU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)