UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PZQZ00OlP88kR3TeDQu0Ct+AQpdJgDU9GOapjsXpE2Q=' 
WHERE 
  key_id = 'e4ea9931cb6b1bce99bcaf9b6da2e2205da38b06ed605b17dd11228c05aa2f67' 
  AND (
    token = 'PZQZ00OlP88kR3TeDQu0Ct+AQpdJgDU9GOapjsXpE2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040