UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4i+hNnS9NTbTJPQkcAIK2MZzsguvldrSzEWxdmrVffM=' 
WHERE 
  key_id = 'b0bc677c2ad552d7858dfa8b33d73de1c20c53356d48ce8af865f0bbdb54e377' 
  AND (
    token = '4i+hNnS9NTbTJPQkcAIK2MZzsguvldrSzEWxdmrVffM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00121