UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ovpL8mnMUoPQ1QFcnyvlvEXkXT+B+FRIcEnZLaGOWl8=' 
WHERE 
  key_id = 'faa924c0b868d5b6edb4fb12d65ff295b54dccb86678f18656988715bccbc2de' 
  AND (
    token = 'ovpL8mnMUoPQ1QFcnyvlvEXkXT+B+FRIcEnZLaGOWl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026