UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'An5fMvgx4q0ktX0ceQHoBxecx+Iz3tUaAFThxTj/6MU='
WHERE
key_id = 'fd0c11be550cfbc2353c6b623192eafd1e9c71b7fcc563f6103498904c2cf56b'
AND (
token = 'An5fMvgx4q0ktX0ceQHoBxecx+Iz3tUaAFThxTj/6MU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)