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