UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ryb4e0qf6hdxCVfZ3Sgi8G35+TSA40kmItpnKG93oP0=' 
WHERE 
  key_id = '006894632bd4e4dafbbde81258343a29669278146a2d7aa3811190ba6bfb660d' 
  AND (
    token = 'ryb4e0qf6hdxCVfZ3Sgi8G35+TSA40kmItpnKG93oP0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039