UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ukoq6joyDGT5f28rGRjXqt9TnfTt4PupEpaVyEiwXzI=' 
WHERE 
  key_id = 'ef6c1dc0522786cd32d9a38983f4cab7a935616581b4c497e518a10386174b52' 
  AND (
    token = 'ukoq6joyDGT5f28rGRjXqt9TnfTt4PupEpaVyEiwXzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041