UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '42m12y1nm4RITne/u8OLNhlHknLUPESJAiOIrEcddYE='
WHERE
key_id = '291085c979e5dd5cf72286c06190e4fbfa8188c4c7937aef8cb8d9dfd07ac4c5'
AND (
token = '42m12y1nm4RITne/u8OLNhlHknLUPESJAiOIrEcddYE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)