UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1tjj5XC16qsAZuTHXBY+vWK0utTi1o5murgcSUEflG8=' 
WHERE 
  key_id = 'd7c6b7267bf611c5b801c8a10e99170c53fcc28521300cc015028b192bcc26c2' 
  AND (
    token = '1tjj5XC16qsAZuTHXBY+vWK0utTi1o5murgcSUEflG8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026