UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2grNb8Xx6M3S4+EXw7bJ7g2M1TWJTh8u5VJXNO5ne0g=' 
WHERE 
  key_id = '8502379a208cd3d2018d4e37f4c5196746c3bb50d68844f1a228d201d5f647eb' 
  AND (
    token = '2grNb8Xx6M3S4+EXw7bJ7g2M1TWJTh8u5VJXNO5ne0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023