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