UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O9WAN13cOofbEsY8uEwv+f1hof1LabbXAMk0OM2OQsc=' 
WHERE 
  key_id = 'a6d5eac620ba24be1f563bb5df839a308d23e55be8ef2636b30fbc5dbbb6e216' 
  AND (
    token = 'O9WAN13cOofbEsY8uEwv+f1hof1LabbXAMk0OM2OQsc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037