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