UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v9W6ydoJFCRLZ6cQhc1posXmI3r2O6VFzkLLIbLnHco='
WHERE
key_id = '031a23b25e1362f01cbe73c91f9474bf31513c4cc5adea4dce661af585775a3d'
AND (
token = 'v9W6ydoJFCRLZ6cQhc1posXmI3r2O6VFzkLLIbLnHco='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)