UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Nl8Lyaof02bJXxz9xCTVwDsLbqW44Q4qoFb+mhs+w7w='
WHERE
key_id = 'b6f65f1e8d201fc2c5003f9e23111f51aa10b34bedf6dd556bbaa27e25588ec7'
AND (
token = 'Nl8Lyaof02bJXxz9xCTVwDsLbqW44Q4qoFb+mhs+w7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)