UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AGKJ93yvFBq2LpmrM9PEywMMMcIQtOAyRxehbSAVdzs=' 
WHERE 
  key_id = '78d30de47941b9a6f440a261d3d55c02f4cfa4b684f0d773cac414a297eb3aef' 
  AND (
    token = 'AGKJ93yvFBq2LpmrM9PEywMMMcIQtOAyRxehbSAVdzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043