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