UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kOxajRpXC2WgT4s1HkWVn6HDPbqVPJWjd4BxABsDz9Q=' 
WHERE 
  key_id = 'ffd7b04d67ea6d6063f438c084e56c1625546c57765ae0f963bb3456e20f77ed' 
  AND (
    token = 'kOxajRpXC2WgT4s1HkWVn6HDPbqVPJWjd4BxABsDz9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019