UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mGgSM+LYoLMUJ5F2XrGpvOAb01aIEqQ3/1smz1VaBwA=' 
WHERE 
  key_id = '1f76e7d6111073700b910284e787a4130af72e6d1004bc8ea379611d228d9f41' 
  AND (
    token = 'mGgSM+LYoLMUJ5F2XrGpvOAb01aIEqQ3/1smz1VaBwA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038