UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5qtlfmwdqC7RJsfA3z/WY9RHCETtMiEJYt87KmCVVNM=' 
WHERE 
  key_id = 'ff4eac1a9e1f7f52165a86ee7680462f331369692ba8c100e341ee1507bd3b67' 
  AND (
    token = '5qtlfmwdqC7RJsfA3z/WY9RHCETtMiEJYt87KmCVVNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065