UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bdgnpcUBj/9d2JWTD1/Lm8Dey9q4OXsskcz5Y8ZI+BQ=' 
WHERE 
  key_id = 'c8eee545de76ede0cf55271488547d048e0c194f4fc01548a68f2699f223d77a' 
  AND (
    token = 'bdgnpcUBj/9d2JWTD1/Lm8Dey9q4OXsskcz5Y8ZI+BQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042