UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iH2sI7vLaRBgVmPfk/qA0WQQAbG3Ezjrf0J1yxOkmYY=' 
WHERE 
  key_id = '613868102431beea11134654dab078676e036bd419bc0000ebf96c9ec2041495' 
  AND (
    token = 'iH2sI7vLaRBgVmPfk/qA0WQQAbG3Ezjrf0J1yxOkmYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053