UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XytZmSYonVeIl30sk878bgh/RHoRBjbOHaULydDQtkU='
WHERE
key_id = '574728b3c6f51432b53c17c5595a28af4dda4077f71ce6cfbca1e105ad98835a'
AND (
token = 'XytZmSYonVeIl30sk878bgh/RHoRBjbOHaULydDQtkU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)