UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y4cDzzleZvZhYkPMEDAXaR2R5GnnCR+tGkxyF703D2M='
WHERE
key_id = '337f17202d459f3650b90d927bb3d5cfc999494a7027d0e0c3796b1f3432a6dd'
AND (
token = 'Y4cDzzleZvZhYkPMEDAXaR2R5GnnCR+tGkxyF703D2M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)