UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K+pE3Q34R3zEhYqdXH5ejOrJQdvtHYiF0YN7NFmliX8='
WHERE
key_id = 'a78c77b1cef09580dde76f0483d07480c6416fbb4262fefc78158f85761e6727'
AND (
token = 'K+pE3Q34R3zEhYqdXH5ejOrJQdvtHYiF0YN7NFmliX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)