UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9nLTcFW+TIWhbCKcUXR9h7BlRgqSLaewYSpVNuHVFQw='
WHERE
key_id = 'd7c1d60a93a04be7aae5adc7a2a2dc0bf2fa78eab90430ae8ac9b419f286badb'
AND (
token = '9nLTcFW+TIWhbCKcUXR9h7BlRgqSLaewYSpVNuHVFQw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)